-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save AmountInput changes on unmount #1883
Save AmountInput changes on unmount #1883
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
@@ -59,6 +59,15 @@ export function AmountInput({ | |||
} | |||
} | |||
|
|||
// Save changes when the component unmounts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: I'm afraid this won't be that simple.
Currently fireChange
will trigger whenever value !== initialValue
. Not just on unmount. So you'll be triggering much more events than expected.
What you actually want is to trigger the onBlur
event when unmounting the Input
component. But that's not really straight-forward.
See the thread here: facebook/react#12363
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read that issue and tried the display: none
solution. It worked on other parts of the codebase but for some reason when used here, the value
state is always zero.
Superceded by #1965 |
Fix AmountInput change not being saved when another editable field is clicked while editing.
Steps to reproduce: